package com.lanou.tk.tourism.adapter;


import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.android.volley.RequestQueue;
import com.lanou.tk.tourism.fragment.RecommendViewPager;
import com.lanou.tk.tourism.entity.RecommendSlide;

import java.util.List;


/**
 * Created by dllo on 15/10/23.
 */
public class RecommendViewPagerAdapter extends FragmentPagerAdapter {
    private List<RecommendSlide> recommendSlides;

    private RequestQueue queue;




    // 数据添加到适配器中
    public void addData(List<RecommendSlide> datas) {
        recommendSlides = datas;
        notifyDataSetChanged();

    }

    public RecommendViewPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        RecommendSlide rs = recommendSlides.get(position);
        String photo = rs.getPhoto();
        String imgUrl = rs.getUrl();


        return RecommendViewPager.getInstance(photo, imgUrl);

    }

    @Override
    public int getCount() {
        return recommendSlides != null && recommendSlides.size() > 0 ? recommendSlides.size() : 0;
    }


    public void setOnMyItemClickListener(FragmentActivity activity) {


    }

}